package com.file.controller;

import ch.qos.logback.core.util.ContextUtil;
import com.file.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther: ZGS
 * @Date: 2019/1/25 11:36
 * @Description:
 */
@RestController
public class FileCongroller {

    @Autowired
    private FileService fileService;

    /**
     * 下载模板(根据type)
     */
    @RequestMapping(value = "/downloadTemplate/{type}", method = RequestMethod.GET)
    public Object downloadTemplate(@PathVariable String type) {
       //ApiRequest<String> apiRequest = ContextUtil.createRequest("下载模板");
       //apiRequest.setParam1(type);
        //下载模板
        //ApiResponse<Object> apiResponse = fileService.downloadTemplate(apiRequest);
        Object obj = fileService.downloadTemplate(type);
        /*if (ApiResponse.CODE_ERROR == apiResponse.getCode()) {
            //失败
            return new ResultMsg(ResultStatusCode.FAIL.getCode(), apiResponse.getMessage());
        } else {
            //成功
            return new ResultMsg(ResultStatusCode.OK.getCode(), "下载模板成功", apiResponse);
        }*/

        return  null;
    }

}
